<template>
  <el-container class="home-container">
        <el-container>
             <!-- 头部 -->
            <el-header height="80px">
                <a href="/">
                    <img src="../assets/logo.png" alt="">
                    <span>导航网</span>
                </a>
            </el-header>
            <el-container>
                <!-- 侧边栏 -->
                <el-aside :width="isCollapse ? '64px':'200px'">
                    <!-- 收起 -->
                    <div class="toggle-button" @click="toggleCollapse">|||</div>
                    <!-- 侧边栏菜单 -->
                    <el-menu  background-color="#333744" text-color="#fff" active-text-color="#409eff" 
                    unique-opened :collapse="isCollapse" :collapse-transition="false" :default-active="this.$router.path" router>
                    <!-- 前端技术面板 -->
                        <el-submenu index="1">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>前端技术</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="/webTechOne">
                                    <template slot="title">
                                        <!-- 图标 -->
                                        <i class="el-icon-menu"></i>
                                        <!-- 文本 -->
                                        <span>前端基础</span>
                                    </template>
                                </el-menu-item>
                                <el-menu-item index="1-2">
                                    <template slot="title">
                                        <!-- 图标 -->
                                        <i class="el-icon-menu"></i>
                                        <!-- 文本 -->
                                        <span>前端2</span>
                                    </template>
                                </el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <!-- 后端技术面板 -->
                        <el-submenu index="2">
                            <template slot="title">
                            <i class="el-icon-location"></i>
                            <span>后端技术</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="2-1">
                                    <template slot="title">
                                        <!-- 图标 -->
                                        <i class="el-icon-menu"></i>
                                        <!-- 文本 -->
                                        <span>后端1</span>
                                    </template>
                                </el-menu-item>
                                <el-menu-item index="2-2">
                                    <template slot="title">
                                        <!-- 图标 -->
                                        <i class="el-icon-menu"></i>
                                        <!-- 文本 -->
                                        <span>后端2</span>
                                    </template>
                                </el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                    </el-menu>
                </el-aside>
                <!-- 左侧内容主体 -->
            <el-main>
                <!-- 路由占位符 -->
                <router-view></router-view>
            </el-main>
            </el-container>
            
        </el-container>
  </el-container>
</template>
<script>
export default {
    data(){
        return{
            // 是否折叠
            isCollapse:false,
        }
    },
    created(){},
    methods:{
        // 点击按钮折叠与展开
        toggleCollapse(){
            this.isCollapse=! this.isCollapse;
        },
    }
}
</script>
<style lang="less" scoped>
.home-container{
    height: 100%;
}
.el-header{
    background-color: #373D41;
    display: flex;
    justify-content:space-between;
    // padding-left: 0;
    align-items: center;
    color: #fff;
    font-size: 20px;
    // 嵌套
    >a{
        display: flex;
        // 纵向对齐
        align-items: center;
        color: white;
        text-decoration: none;
        
    }
    span{
        margin-left: 15px;
    }
    img{
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }
}
.el-aside{
    background-color: #333744;
    .el-menu{
        border-right: none;
    }
}
.el-main{
    background-color: #eaedf1;
}
.toggle-button{
    background-color: #4a5064;
    font-size: 10px;
    line-height: 24px;
    color:#fff;
    text-align: center;
    // 字间距
    letter-spacing: 0.2em;
    cursor: pointer;
}
</style>
